package com.whfc.emp.xxl.job;

import com.whfc.XxlJobConfig;
import com.whfc.emp.helmet.ZbznVideoApi;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Component;

/**
 * @Description: 筑邦视频安全帽拉取记录定时任务
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/9/9 10:44
 */
@Component
@ConditionalOnBean(XxlJobConfig.class)
public class ZbznHelmetDataJob {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ZbznVideoApi zbznVideoApi;

    /**
     * 发送筑邦智能实时数据命令
     */
    @XxlJob("getHelmetData")
    public void getZbznHelmetData() {
        logger.info("=====定时任务筑邦视频安全帽数据拉取====");
        try {
            zbznVideoApi.getDeviceInfo();
        } catch (Exception ex) {
            logger.error("筑邦视频安全帽指令异常", ex);
        }
    }


}
